<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-3.4.1.min.js"></script>
</head>
<body>
<form method="post" enctype="multipart/form-data" id="input-excle">
    <!--<div class="form-group">-->
    <!--<input type="file" name="file"/>-->
    <!--&lt;!&ndash; <label class="control-label" >username</label>-->
    <!--<input type="text" class="form-control"> &ndash;&gt;-->
    <!--</div>-->
    <!--<div class="modal-footer">-->
    <!--<button  class="btn  btn-default" data-dismiss="modal">-->
    <!--取消-->
    <!--</button>-->
    <!--<input type="submit"  value="提交" class="btn btn-primary" id="btn-input-excle">-->
    <!--</div>-->
    <div class="form-group">
        <input type="file" name="file">
    </div>
    <div class="modal-footer">
        <button class="btn  btn-default" data-dismiss="modal">取消</button>
        <button type="button" class="btn btn-primary" id="btn-input-excle">提交</button>

    </div>
</form>
<script>
    $("#btn-input-excle").click(function () {
        var formdata = new FormData(document.getElementById("input-excle"))
        $.ajax({
            url: "/basicInfo/input",
            data: formdata,
            dataType: "json",
            type: "post",
            contentType: false,
            processData: false,
            success: function (result) {
                if (result.code == 200) {
                    alert("导入成功")
                    location.href = "index.html"
                }
            },
            error: function (xhr) {
                alert(xhr.message)
            }
        })
    })
</script>
</body>
</html>